# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=mptcp-abuse
pkgver=6.b0eeb27
pkgrel=4
groups=('blackarch' 'blackarch-networking' 'blackarch-recon' 'blackarch-scanner')
pkgdesc='A collection of tools and resources to explore MPTCP on your network. Initially released at Black Hat USA 2014.'
arch=('any')
url='https://github.com/Neohapsis/mptcp-abuse'
license=('GPL2')
depends=('python2')
makedepends=('git')
source=('git+https://github.com/Neohapsis/mptcp-abuse.git')
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" README.md \
    "MPTCP Cheatsheet.pdf"
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm -rf README.md "MPTCP Cheatsheet.pdf"

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/mptcp-fragmenter" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 mptcp_fragmenter.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/mptcp-fragmenter"

  cat > "$pkgdir/usr/bin/mptcp-scanner" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 mptcp_scanner.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/mptcp-scanner"
}

